﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Drawing.Imaging;

public partial class demoCompressImage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //using System.Drawing;
        //using System.Drawing.Imaging;
        Bitmap OriginalBM = new Bitmap(Server.MapPath(@"~\images\sp6.jpg"));
        Size newSize = new Size(100, 100);
        Bitmap ResizedBM = new Bitmap(OriginalBM, newSize);
        ResizedBM.Save(Server.MapPath(@"~\images\tan.jpg"), ImageFormat.Jpeg);
    }
}